<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>学生信息管理系统</title>
</head>
<body>
	<?php include "menu.php"; 
		//输出删除失败的提示
		// switch($_GET['errno']){
		// 	case 3: echo "<h3 style='color:red'>删除失败!</h3>";break;
		// }

	?>

	<table width="600px" border='1px'>
		<tr>
			<th>ID</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>性别</th>
			<th>班级</th>
			<th>操作</th>
		</tr>
		<?php
			//六脉神剑	
			$sex = array("m"=>"男","w"=>"女");
			include("dbconfig.php");
			$link = @mysqli_connect(HOST,USER,PASSWD,DBNAME) or die("数据库连接失败");
			mysqli_set_charset($link,"utf8");
			$sql = "select * from test";
			// $res = mysqli_query($link,$sql);
			print_r(mysqli_query($link,$sql));
			die;
			if(mysqli_num_rows>0){
				echo "$row = mysqli_fetch_all($res,MYSQLI_ASSOC)";
				echo "<tr>";
				echo "<td>{$row['uid']}</td>";
				echo "<td>{$row['name']}</td>";
				echo "<td>{$row['age']}</td>";
				echo "<td>{$sex[$row['sex']]}</td>";
				echo "<td>{$row['class']}</td>";
				
				echo "<td>
					<a href='action.php?a=del&id={$row['uid']}'>删除</a>  
					<a href='edit.php?id={$row['uid']}'>修改</a>  
					</td>";
				echo "</tr>";
			}
			
		?>

	</table>
	<?php  echo "一共查询到".mysqli_num_rows($res)."条记录"; 

		mysqli_close($link);
		mysqli_free_result($res);
	  ?>
</body>
</html>